package com.mtsmda.threadsEx;

public class FirstThread {

	public final static void main(String[] args) throws InterruptedException {
		System.out.println(Thread.currentThread().getName());
		Thread.sleep(7500);
		MyThread myThread = new MyThread();
		Thread thread1 = new Thread(myThread, "first");
		thread1.start();
		Thread thread2 = new MyThread2("second");
		thread2.start();
		
		System.out.println("stop - " + Thread.currentThread().getName());
	}
}

class MyThread implements Runnable {
	@Override
	public void run() {
		System.out.println("Start " + Thread.currentThread().getName());
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		System.out.println("Stop " + Thread.currentThread().getName());
	}
}

class MyThread2 extends Thread {

	public MyThread2() {

	}

	public MyThread2(String name) {
		super(name);
	}

	@Override
	public void run() {
		System.out.println("Start " + Thread.currentThread().getName());
		try {
			Thread.sleep(2500);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		System.out.println("Stop " + Thread.currentThread().getName());
	}
}